<template>
	<view class="container">
		<view class="jilu_list">
			<view class="block_div xiangmu" v-for="(item,index) in dataList" :key="index">
				<view class="list_title uni-flex uni-flex-align uni-flex-bt">
					<view class="left">{{item.remark}}</view>
				</view>
				<view class="list_title" style="border-bottom: none;margin-bottom: 0;">
					<view class="left flex flex-align ">
						<image :src="item.user.headimg" mode=""></image> {{item.user.nickname}}</view>
					<view class="left">优惠券名称：{{item.coupon.name}}</view>
					<view class="left">优惠券金额：{{item.coupon.price}}</view>
					<view class="left">核销时间: {{item.created_at}}</view>
				</view>
				<!-- <view class="miaoshu" v-if="item.status==4">驳回原因: <text>{{item.remark}}</text></view> -->
			</view>
		</view>
		<view class="empty-box" v-if="dataList.length==0">
			<image src="/static/ic_nodata.png" mode=""></image>
			<view class="">暂无数据</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				dataList:[],
				type:'',
				m_type:'',
				id:''
			}
		},
		onLoad(e) {
			if(e.id){
				this.id = e.id
				this.couponHx()
			}
			this.getList()
		},
		onReachBottom() {
			this.page++
			this.getList()
		},
		methods: {
			getList(){
				let that = this
				that.tui.request('api.auth.coupon/use_coupon_list', "POST",{page:that.page}, false, false, true).then((res) => {
					if(res.code==1){
						if(that.page==1){
							that.dataList = res.data.list
						}else{
							that.dataList = that.dataList.concat(res.data.list)
						}
					}
				}).catch((res) => {})
			},
			couponHx(){
				let that = this
				that.tui.request('api.auth.coupon/use_coupon', "POST",{coupon_log_id:that.id}, false, false, true).then((res) => {
					that.tui.toast(res.info)
					if(res.code==1){
						that.page=1
						that.getList()
					}
				}).catch((res) => {})
			},
		}
	}
</script>

<style lang="scss">
	page{background: #f7f7f7;padding-top: 20rpx;}
	.xiangmu{margin:0 20rpx 20rpx;padding: 30rpx;background: #fff;border-radius: 10rpx;
		.list_title{line-height: 60rpx;border-bottom: 1px solid #eee;margin-bottom: 20rpx;padding-bottom: 10rpx;
			.left{color: #999;
				image{width: 80rpx;height: 80rpx;border-radius: 100%;margin-right: 10rpx;}
			}
			.right{color: $base;}
		}
		.x_title{font-weight: bold;margin-bottom: 20rpx;}
		.list{height: 60rpx;
			.right{font-weight: bold;text-align: right;
				.green{font-size: 28rpx;}
				.grey{font-weight: 400;color: #999;}
			}
		}
		.miaoshu{margin-top: 10rpx;font-size: 24rpx;
			text{color: #07c160;;}
		}
	}
</style>
